/**
 * $Id: input.c 3 2010-10-02 23:39:41Z pmedia@xi-intersection.net $
 */

// -----------------------------------------------------------------------------
// Includes
// -----------------------------------------------------------------------------

// Globals (e.g. system functions and globally shared definitions)
#include "include/global.h"

// Game Modules
#include "include/init-deinit.h"
#include "include/input.h"
#include "include/logic.h"
#include "include/main.h"
#include "include/render.h"

// -----------------------------------------------------------------------------
// Functions
// -----------------------------------------------------------------------------

/**
 * Input Function
 * 
 * This function does react on several input events.
 * These could come from any HID. Also, it does react on events from the
 * operating system / window manager
 * 
 */

void input(void) {
	SDL_Event event;
	
	while (SDL_PollEvent(&event)) {
		switch(event.type) {
			case SDL_NOEVENT:			/**< Unused (do not remove) */
				break;
			
			case SDL_ACTIVEEVENT:		/**< Application loses/gains visibility */
				break;
			
			case SDL_KEYDOWN:			/**< Keys pressed */
				break;
			
			case SDL_KEYUP:				/**< Keys released */
				break;
			
			case SDL_MOUSEMOTION:		/**< Mouse moved */
				break;
			
			case SDL_MOUSEBUTTONDOWN:	/**< Mouse button pressed */
				break;
			
			case SDL_MOUSEBUTTONUP:		/**< Mouse button released */
				break;
			
			case SDL_JOYAXISMOTION:		/**< Joystick axis motion */
				break;
			
			case SDL_JOYBALLMOTION:		/**< Joystick trackball motion */
				break;
			
			case SDL_JOYHATMOTION:		/**< Joystick hat position change */
				break;
			
			case SDL_JOYBUTTONDOWN:		/**< Joystick button pressed */
				break;
			
			case SDL_JOYBUTTONUP:		/**< Joystick button released */
				break;
			
			case SDL_QUIT:				/**< User-requested quit */
				termination = TRUE;
				break;
				
			case SDL_SYSWMEVENT:		/**< System specific event */
				break;
			
			case SDL_EVENT_RESERVEDA:	/**< Reserved for future use.. */
				break;
			
			case SDL_EVENT_RESERVEDB:	/**< Reserved for future use.. */
				break;
			
			case SDL_VIDEORESIZE:		/**< User resized video mode */
				break;
			
			case SDL_VIDEOEXPOSE:		/**< Screen needs to be redrawn */
				break;
			
			case SDL_EVENT_RESERVED2:	/**< Reserved for future use.. */
				break;
			
			case SDL_EVENT_RESERVED3:	/**< Reserved for future use.. */
				break;
			
			case SDL_EVENT_RESERVED4:	/**< Reserved for future use.. */
				break;
			
			case SDL_EVENT_RESERVED5:	/**< Reserved for future use.. */
				break;
			
			case SDL_EVENT_RESERVED6:	/**< Reserved for future use.. */
				break;
			
			case SDL_EVENT_RESERVED7:	/**< Reserved for future use.. */
				break;
			
			case SDL_USEREVENT:
				break;
			
			default:
				printf("Error: Unhandled Event %i\n", event.type);
				break;
		}
	}
}

